// Image
// (c) jimon game studio

#ifndef JEH_CIMAGE
#define JEH_CIMAGE

#include "IImage.h"

namespace je
{
	namespace video
	{
		//! Image
		class CImage:public je::video::IImage
		{
		private:
			//! Image
			void * Image;

			//! Color Format
			ImageColorFormat ColorFormat;

			//! Image Size
			jeVector2di Size;

			//! True If Locked
			u1 Locked;
		public:
			//! Constructor
			CImage(const void * Data,const jeVector2di & ImgSize,ImageColorFormat Format);

			//! Constructor
			CImage(const jeVector2di & ImgSize,ImageColorFormat Format);

			//! Destructor
			~CImage();

			//! Lock Image
			void Lock();

			//! UnLock Image
			void UnLock();

			//! Return true if locked
			u1 IsLocked();

			//! Get Pointer to data
			void * GetPtr();

			//! Draw Bitmap on image
			void DrawBitmapOnImage(void * Bitmap,const jeVector2di & DrawPosition,const jeVector2di & BitmapOffset,const jeVector2di & BitmapCopySize,const jeVector2di & BitmapSize,ImageColorFormat BitmapFormat,u1 WithBlending = false);

			//! Draw Image on image
			void DrawImageOnImage(IImage * CopyImage,const jeVector2di & DrawPosition,const jeVector2di & ImageOffset,const jeVector2di & DrawSize,u1 WithBlending = false);

			//! Return Image Format
			ImageColorFormat GetFormat();

			//! Return size of image
			const jeVector2di & GetSize();

			//! Return Bytes per pixel
			u32 GetBytesPerPixel();

			//! Flip Image Vertical, lock and unlock if image unlocked
			void FlipVertical();

			//! Flip Image Horizontal, lock and unlock if image unlocked
			void FlipHorizontal();

			//! Resize
			IImage * Copy(const jeVector2di & CopyPosition,const jeVector2di & CopySize);

		};
	}
}

#endif
